package com.bestcem.xm.user.handler;

import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;

/**
 * 组织层级模板-填写须知sheet处理器
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/7/19 15:27
 */
public class GroupSheetHandler implements CellWriteHandler {

    @Override
    public void afterCellDispose(CellWriteHandlerContext context) {
        Cell cell = context.getCell();
        CellStyle cellStyle = cell.getCellStyle();
        // 设置宽度
        context.getWriteSheetHolder().getSheet().setColumnWidth(cell.getColumnIndex(), 16 * 256);

        // 设置高度
        cell.getRow().setHeight((short) (21 * 20));

        cell.getRow().setRowStyle(cellStyle);
        cell.setCellStyle(cellStyle);
    }

}
